﻿using System;

namespace ZYLI
{
    class Program
    {
        static void Main(string[] args)
        {
            test4();
        }
        //九九乘法表
        static void test()
        {
            string[,] arr = new string[9, 9];

            for (int i = 1; i < arr.GetLength(0); i++)
            {

                for (int j = 1; j <= i; j++)

                {
                    arr[i, j] = (i + 1) + "*" + (j + 1) + "=" + (i + 1) * (j + 1) + "\t";
                }

            }
            for (int i = 1; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    Console.Write(arr[i, j]);

                }
                Console.WriteLine();
            }


        }
        // 打印实心正方形。
        static void test1()
        {
            Console.WriteLine("请输入正方形边长：");
            int arr = int.Parse(Console.ReadLine());
            for (int i = 0; i < arr; i++)
            {
                for (int j = 0; j < arr; j++)

                    Console.Write("*");


                Console.WriteLine();

            }
            Console.ReadKey();
        }

        // 打印空心正方形
        static void test2()
        {
            Console.WriteLine("请输入正方形边长：");
            int a = int.Parse(Console.ReadLine());
            string[,] arr = new string[a, a];
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    arr[i, j] = "*" + " ";
                }
            }
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    if (i == 0 || j == 0 || i == arr.GetLength(0) - 1 || j == arr.GetLength(1) - 1)
                    {
                        Console.Write("*");
                    }
                    else
                    {
                        Console.Write(" ");
                    }
                    Console.WriteLine();
                }
            }
        }
        // 菱形

        static void test3()
        {
            Console.WriteLine("请输入奇数：");
            int x = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i <= (x + 1) / 2; i++)

            {
                for (int j = (x - 1) / 2; j >= i; j--)
                {
                    Console.Write(" ");
                }
                for (int b = 1; b <= i * 2 - 1; b++)
                {
                    Console.Write("* ");
                }
                Console.WriteLine();
            }
            for (int i = (x - 1) / 2; i >= 1; i--)
            {
                for (int j = i - 1; j < (x - 1) / 2; j++)
                {
                    Console.Write(" ");
                }
                for (int b = 1; b <= i * 2 - 1; b++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();

            }
        }
        //如果一个数组保存元素是有序的（从大到小），向这个数组中插入一个数，使得插入后的数组元素仍然保持有序。

        static void test4()
        {
            {
                int[] arr = { 10, 8, 6, 4, 2 };
                int[] crr = new int[6];
                Console.WriteLine("输入一个数");
                int brr = int.Parse(Console.ReadLine());
                for (int i = 0; i < arr.Length; i++)
                {
                    crr[i] = arr[i];
                }
                crr[5] = brr;
                Array.Sort(crr);
                Array.Reverse(crr);
                for (int i = 0; i < crr.Length; i++)
                {
                    Console.Write(crr[i] + " ");
                }
            }
        }
    }
}
